
import {request, METHOD} from '@/utils/request'
import qs from 'qs'

const BASE_URL = process.env.VUE_APP_API_BASE_URL

/**
 * 商品所有获取接口
 */
export async function getGoodsAll() {
  return request(`${BASE_URL}/Goods/getGoodsAll`, METHOD.POST, null)
}
/**
 * 商品添加接口
 */
export async function addGoods(data) {
  return request(`${BASE_URL}/Goods/addGoods`, METHOD.POST, qs.stringify(data))
}

/**
 * 文件添加接口
 */
export async function addFileData(data) {
 
  return request(`${BASE_URL}/FileData/addFileData`, METHOD.POST, qs.stringify(data))
}

/**
 * 商品删除接口
 * 
 */

 export async function oddGoodss(id) {
  console.log(1111111);
  return request(`${BASE_URL}/Goods/delGoods/${id}`, METHOD.DELETE)
}
// 详情
export async function details(data) {
  console.log(1111111);
  return request(`${BASE_URL}/Goods/getGoodsDetails/`, METHOD.POST, qs.stringify(data))
}
// 编辑
export async function editors(data) {
  console.log(1111111);
  return request(`${BASE_URL}/Goods/updateGoodsById/`, METHOD.POST, qs.stringify(data))
}
//  export function oddGoodss(id) {
//    console.log('周开心');
//    console.log(id);
//   return request({
//     method: 'DELETE',
//     url:`${BASE_URL}/Goods/delGoods/${id}`
//   })
// }
// 更新

export default {
  getGoodsAll,
  addGoods,
  addFileData,
  oddGoodss,
  details,
  editors
}
